//
//  AQIphoneManager.m
//  RunLoopDemo
//
//  Created by zhangjikuan on 2020/11/10.
//  Copyright © 2020 hsgd. All rights reserved.
//

#import "AQIphoneManager.h"

@implementation AQIphoneManager
/// 获取设备型号
+(iPhoneType)iphone {
    BOOL ipad   = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
    CGSize size = [[UIScreen mainScreen] currentMode].size;
    CGFloat w   = size.width;
    CGFloat h   = size.height;
    iPhoneType type = iPhoneTypeUnkuown;
    if (ipad == YES)
    {
        type = iPhoneTypeiPad;
    }
    else
    {
        if (w == 640 && h == 960) {
            type = iPhoneTypeiPhone4;
            NSLog(@"iPhoneTypeiPhone4");
        }else if (w == 640 && h == 1136){
            type = iPhoneTypeiPhone5;
            NSLog(@"iPhoneTypeiPhone5");

        }else if (w == 750 && h == 1134){
            type = iPhoneTypeiPhone;
            NSLog(@"iPhoneTypeiPhone");

        }else if (w == 1242 && h == 2208){
            type = iPhoneTypeiPhonePlus;
            NSLog(@"iPhoneTypeiPhonePlus");

        }else if (w == 1080 && h == 2340){
            type = iPhoneTypeiPhoneMini;
            NSLog(@"iPhoneTypeiPhoneMini");

        }else if (w == 828 && h == 1792){
            type = iPhoneTypeiPhoneXR;
            NSLog(@"iPhoneTypeiPhoneXR");

        }else if (w == 1125 && h == 2436){
            type = iPhoneTypeiPhoneX_XS;
            NSLog(@"iPhoneTypeiPhoneX_XS");

        }else if (w == 1170 && h == 2532){
            type = iPhoneTypeiPhonePro;
            NSLog(@"iPhoneTypeiPhonePro");

        }else if (w == 1242 && h == 2688){
            type = iPhoneTypeiPhoneMax;
            NSLog(@"iPhoneTypeiPhoneMax");

        }else if (w == 1284 && h == 2778){
            type = iPhoneTypeiPhoneProMax;
            NSLog(@"iPhoneTypeiPhoneProMax");

        }else{
            type = iPhoneTypeUnkuown;
            NSLog(@"iPhoneTypeUnkuown");

        }
    }
    return type;
    
}
 
/// 导航条高度
+(CGFloat)navgationBerHeight {
    iPhoneType type =  [self iphone];
    switch (type) {
        case iPhoneTypeiPhone4 ... iPhoneTypeiPhonePlus:
        {
            return 64.f;
        }
            break;
        case iPhoneTypeiPhoneMini ... iPhoneTypeiPhoneProMax:
        {
            return 88.f;
        }
            break;
        default:
            return 64.f;
            break;
    }
    
}
 
/// 标签栏高度
+(CGFloat)statusBarHeight {
    iPhoneType type =  [self iphone];
    switch (type) {
        case iPhoneTypeiPhone4 ... iPhoneTypeiPhonePlus:
        {
            return 20.f;
        }
            break;
        case iPhoneTypeiPhoneMini ... iPhoneTypeiPhoneProMax:
        {
            return 44.f;
        }
            break;
        default:
            return 20.f;
            break;
    }
    
}
 
/// 是否为刘海屏
+(BOOL)isLiuHaiPing {
    iPhoneType type =  [self iphone];
    switch (type) {
        case iPhoneTypeiPhone4 ... iPhoneTypeiPhonePlus:
        {
            return NO;
        }
            break;
        case iPhoneTypeiPhoneMini ... iPhoneTypeiPhoneProMax:
        {
            return YES;
        }
            break;
        case iPhoneTypeiPad:
        {
            return NO;
        }
            break;
        default:
            return YES;
            break;
    }
    
}
- (void)onNext {
    NSLog(@"onNext");
    
}
@end
